#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/7/25 13:20
# @Author  : Jet
# @Email   : jyan@abot.cn
# @File    : my_test02.py

dict1 = {"a":10,"B":20,"C":True,"D":"hello world","e":"python教程"}

dict2 = {}
for key in dict1:
    if key.islower():
        dict2[key] = dict1[key]

print(dict2)


# 过滤key值是小写字母的项目
dict2 = {key:value for key,value in dict1.items() if key.islower()}
print(dict2)

exit(100)



# 过滤value的类型为int的项目
dict3 = {key:value for key,value in dict1.items() if type(value)is int}
print(dict3)

# 另一种过滤变量类型的方式，比较type和isinstance的区别，以及int和bool类型的联系
# bool类型会被判断为true，具体见"my_test01.py"
dict4 = {key:value for key,value in dict1.items() if isinstance(value, int)}
print(dict4)
